package com.demo2do.fms.admin.service.report.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.demo2do.core.entity.page.Page;
import com.demo2do.core.persistence.GenericDaoSupport;
import com.demo2do.fms.admin.entity.search.report.HeavyNoLoadInstructionSearch;
import com.demo2do.fms.admin.service.report.HeavyNoLoadInstructionService;
import com.demo2do.fms.entity.report.HeavyNoLoadInstruction;

/**
 * 
 * @author Ysy
 *
 */
@Service("heavyNoLoadInstructionService")
public class HeavyNoLoadInstructionServiceImpl implements HeavyNoLoadInstructionService {
	
	@Value("#{config['shipment.electronic.url']}")
	private String electronicUrl;
    
    private static final Logger logger = LoggerFactory.getLogger(HeavyNoLoadInstructionServiceImpl.class);
    @Autowired
    private GenericDaoSupport genericDaoSupport;
    /* (non-Javadoc)
     * @see com.demo2do.fms.admin.service.business.ShipmentService#countShipment(com.demo2do.fms.admin.entity.search.business.ShipmentSearch)
     */
	@Override
	public int countHeavy(HeavyNoLoadInstructionSearch heavyNoLoadInstructionSearch) {
		// TODO Auto-generated method stub
		String sentence = heavyNoLoadInstructionSearch.buildSentenceTemplate();
		Map<String, Object> parameters = heavyNoLoadInstructionSearch.buildParameters();
		return genericDaoSupport.count(sentence, parameters);
	}
	
	/* (non-Javadoc)
	 * @see com.demo2do.fms.admin.service.business.ShipmentService#countShipment(com.demo2do.fms.admin.entity.search.business.ShipmentSearch)
	 */
	
	@Override
	public List<HeavyNoLoadInstruction> listhHeavyNoLoadInstructions(
			HeavyNoLoadInstructionSearch heavyNoLoadInstructionSearch, Page page) {
		// TODO Auto-generated method stub
		String sentence = heavyNoLoadInstructionSearch.buildSentenceTemplate();
		Map<String, Object> parameters = heavyNoLoadInstructionSearch.buildParameters();
		List heavyNoLoadInstruction =genericDaoSupport.searchForList(sentence, parameters, page.getBeginIndex(), page.getEveryPage());
		page.calculate();
		return heavyNoLoadInstruction;
	}
	/* (non-Javadoc)
	 * @see com.demo2do.fms.admin.service.business.ShipmentService#countShipment(com.demo2do.fms.admin.entity.search.business.ShipmentSearch)
	 */
	@Override
	public List<HeavyNoLoadInstruction> listhHeavyNoLoadInstructionAll(
			HeavyNoLoadInstructionSearch heavyNoLoadInstructionSearch) {
		// TODO Auto-generated method stub
		String sentence = heavyNoLoadInstructionSearch.buildSentenceTemplate();
		Map<String, Object> parameters = heavyNoLoadInstructionSearch.buildParameters();
		List heavyNoLoadInstruction = genericDaoSupport.searchForCacheableList(sentence, parameters);
		return heavyNoLoadInstruction;
	}
	
	
	

    
}